<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="/demo/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="/demo/vue-2.4.2/vue.min.js"></script>
<script type="text/javascript" src="/demo/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/demo/bootstrap-fileinput-4.4.5/js/fileinput.min.js"></script>

<link rel="stylesheet" type="text/css" href="/demo/bootstrap-3.3.7/css/bootstrap.min.css"></link>
<link rel="stylesheet" type="text/css" href="/demo/bootstrap-fileinput-4.4.5/css/fileinput.min.css"></link>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>search-admin</title>
</head>
<body >
    
	<div class="container" id="container"><!-- main container start -->
	    <h3 class="page-header">索引管理</h3>
		<!-- 基本操作 -->
		<div class="panel panel-default">
			<div class="panel-heading">
				<button class="btn btn-primary" v-on:click="showCreateIndexModal"
					type="button">创建索引</button>
				&nbsp;&nbsp;&nbsp;&nbsp;
				<button class="btn btn-primary" v-on:click="showCreateTypeModal"
					type="button">创建类型</button>
			</div>
		</div><!-- header container end -->
        
        <!-- 索引信息列表 -->
		<div class="panel panel-default"><!-- body container start -->
			<div class="panel-heading">
			  <!-- <form class="form-inline form-search" method="post"> -->
			   <input type="text" id="indexNameForSearch">
			   <button type="submit" v-on:click="searchIndex">检索</button>
			  <!-- </form> -->
            </div>
			<div class="panel-body">
			  <table class="table table-striped table-bordered table-hover">
			    <thead>
			      <tr>
			        <th>名称</th>
			        <th>版本</th>
			        <th>操作</th>
			      </tr>
			    </thead>
			    <tbody>
			      <tr v-for="record in recordSet">
			        <td><a href="#" v-on:click="showIndexInfoMoadal(record.name)">{{ record.name }}</a></td>
			        <td>{{ record.version }}</td>
			        <td><a href="#" v-on:click="deleteIndex(record.name)"><i class="icon-remove"></i>删除</a></td>
			      </tr>
			    </tbody>
			  </table>
			</div>
		</div><!-- body container end -->
		<!-- 分页 -->
		<div id="app">
	      <vue-nav :cur="currentPageNo" :all="pageCount" :callback="callback"></vue-nav>
	      <p>{{msg}}</p>
	    </div>
		
		<h3 class="page-header">集群管理</h3>
		<!-- 集群信息列表 -->
		<div class="panel panel-default"><!-- body container start -->
			<div class="panel-heading">
			   <button type="submit" v-on:click="loadClusterInfo">获取集群信息</button>
            </div>
			<div class="panel-body">
			  <h5>集群名称 ： {{clusterName}}</h5>
			  <h5>集群状态： {{clusterStatus}}</h5>
			  <table class="table table-striped table-bordered table-hover">
			    <thead>
			      <tr>
			        <th>名称</th>
			        <th>主机名称</th>
			        <th>角色</th>
			      </tr>
			    </thead>
			    <tbody>
			      <tr v-for="record in clusterNodes">
			        <td>{{ record.name }}</td>
			        <td>{{ record.hostName }}</td>
			        <td>{{ record.role }}</td>
			      </tr>
			    </tbody>
			  </table>
			</div>
		</div><!-- body container end -->
		
		<h3 class="page-header">数据导入<small>(提示: 现在只支持导入文本数据，每列使用<strong>\t</strong>分割。)</small></h3>
		<!-- 集群信息列表 -->
		<div class="panel panel-default"><!-- body container start -->
			<div class="panel-heading">
		      <input id="uploadfile" type="file">
		      <button type="submit" v-on:click="importFileData" class="btn btn-primary">上传</button>
            </div>
			<div class="panel-body">
			  <h5>数据信息展示</h5>
			  
			</div>
		</div><!-- body container end -->
		
		<!-- modals -->
	    <!-- 创建索引 modal 开始 -->
		<div class="modal fade" id="createIndexMoadal" tabindex="-1" aria-hidden="true" role="dialog">
		  <div class="modal-dailog" style="width: 700px;">
		    <div class="modal-content">
		      <div class="modal-header">
		       <button class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		       <h4 class="modal-title">创建索引</h4>
		      </div>
		      <div class="modal-body" style="width: 670px;" >
		        <form action="" method="post" class="form-horizontal" role="form" id="createIndexForm">
		          <div class="form-group">
		           <label for="indexName" class="col-sm-2 control-label">名称：</label>
		           <div class="col-sm-6">
		             <input type="text" class="form-control" name="indexName" />
		           </div>
		          </div>
		          
		          <div class="form-group">
		           <label class="col-sm-2 control-label">设置：</label>
		           <hr>
		          </div>
		          
		          <div class="form-group">
		           <label for="shardsNum" class="col-sm-offset-2 col-sm-3 control-label">number_of_shards：</label>
		           <div class="col-sm-3">
		             <input type="text" class="form-control" name="shardsNum" value="5" />
		           </div>
		          </div>
		          
		          <div class="form-group">
		           <label for="replicasNum" class="col-sm-offset-2 col-sm-3 control-label">number_of_shards：</label>
		           <div class="col-sm-3">
		             <input type="text" class="form-control" name="replicasNum" value="2" />
		           </div>
		          </div>
		          
		        </form>
		      </div>
		      <div class="modal-footer">
		        <button class="btn btn-defalut" v-on:click="createIndex">创建</button>
		      </div>
		    </div>
		  </div>
		</div>
		<!-- 创建索引 modal 结束 -->
		
		
		<!-- 创建索引类型 modal 开始 -->
		<div class="modal fade" id="createTypeMoadal" tabindex="-1" aria-hidden="true" role="dialog">
		  <div class="modal-dailog" style="width: 700px;">
		    <div class="modal-content">
		      <div class="modal-header">
		       <button class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		       <h4 class="modal-title">创建类型</h4>
		      </div>
		      <div class="modal-body" style="width: 670px;" >
		        <form action="" method="post" class="form-horizontal" role="form" id="createTypeForm">
		        
		          <div class="form-group">
		           <label for="indexList" class="col-sm-2 control-label">当前索引：</label>
		           <div class="col-sm-6">
		             <select name="indexList" class="selectpicker">
		              <!-- 当前的所有index -->
		              <option v-for="index in allIndices" >{{index.name}}</option>
		             </select>
		           </div>
		          </div>
		          
		          <div class="form-group">
		           <label for="typeName" class="col-sm-2 control-label">类型名称：</label>
		           <div class="col-sm-6">
		             <input type="text" class="form-control" name="typeName" />
		           </div>
		          </div>
		          
		          <div class="form-group">
		           <label for="typeSettings" class="col-sm-2 control-label">类型设置：</label>
		           <div class="col-sm-6">
		             <textarea rows="10" class="form-control" name="typeSettings" />{"name": {"type": "string", "analyzer": "ik_smart"},"age": {"type": "long"}}</textarea>
		           </div>
		          </div>
		        </form>
		      </div>
		      <div class="modal-footer">
		        <button class="btn btn-defalut" v-on:click="createType">创建</button>
		      </div>
		    </div>
		  </div>
		</div>
		<!-- 创建索引类型 modal 结束 -->
		
		<!-- 查看索引详情 modal 开始 -->
		<div class="modal fade" id="indexInfoMoadal" tabindex="-1" aria-hidden="true" role="dialog">
		  <div class="modal-dailog" style="width: 700px;">
		    <div class="modal-content">
		      <div class="modal-header">
		       <button class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		       <h4 class="modal-title">索引详情</h4>
		      </div>
		      <div class="modal-body" style="width: 670px;" >
		        <form action="" method="post" class="form-horizontal" role="form" id="createTypeForm">
		          <div>{{indexInfo}}</div>
		        </form>
		      </div>
		      <div class="modal-footer">
		        <button class="btn btn-defalut" v-on:click="createType">创建</button>
		      </div>
		    </div>
		  </div>
		</div>
		<!-- 查看索引详情 modal 结束 -->
	</div><!-- main container end -->
	
</body>


<link rel="stylesheet" type="text/css" href="/demo/css/vue-nav.css"></link>
<script src="/demo/js/vue-nav.js"></script>
<script type="text/javascript" src="/demo/js/admin/admin.js"></script>
</html>